package trident.partition;

import org.apache.storm.trident.operation.BaseFunction;
import org.apache.storm.trident.operation.TridentCollector;
import org.apache.storm.trident.tuple.TridentTuple;
import org.apache.storm.tuple.Values;

public class AverageFunction extends BaseFunction {
    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        Integer hive = tuple.getIntegerByField("hive");
        Integer storm = tuple.getIntegerByField("storm");

        collector.emit(new Values((hive+storm)/2)); // 追加
    }
}
